package capaPersistencia;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class GestorConexiones {

	private final static String DRIVER_CLASS_NAME = "com.mysql.jdbc.Driver";
	private final static String DRIVER_URL = "jdbc:mysql://144.76.19.105/proyectosoftware";
	private final static String USER = "a652436";
	private final static String PASSWORD = "doigte19";

	static {

		try {
			Class.forName(DRIVER_CLASS_NAME);
		} catch (ClassNotFoundException e) {
			e.printStackTrace(System.err);
		}

	}

	private GestorConexiones() {
	}

	public final static Connection getConnection() throws SQLException {
		try {
			return DriverManager.getConnection(DRIVER_URL, USER, PASSWORD);
		} catch (Exception e) {
			e.printStackTrace(System.err);
			return DriverManager.getConnection("jdbc:mysql://www.db4free.net/proyectosoftware", USER, PASSWORD);
		}

	}

}
